package louis.echarts;

import cn.hutool.core.io.IoUtil;
import louis.echarts.service.EChartsService;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.ConfigurableApplicationContext;

import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;

/**
* @Description 核心启动类
* @Author Louis
* @Date 2022/07/10 18:03:31
*/
@SpringBootApplication
public class LouisApplication {

	public static void main(String[] args) throws FileNotFoundException {
		ConfigurableApplicationContext run = SpringApplication.run(LouisApplication.class, args);
		//模板文件里面的 opt={ 不要有空格,文件内不要有注释
		File file = run.getBean(EChartsService.class).generateEcharts("demo.ftl");
		IoUtil.copy(new FileInputStream(file),new FileOutputStream("F:\\test.jpg"));
	}

}
